package system

import (
	"github.com/gin-gonic/gin"
	"ruoyi-go/internal/core/auth"
	"ruoyi-go/internal/framework/utils/rest"
	"ruoyi-go/internal/web/system/service"
)

func RegisterProfileRouter(g *gin.Engine) {
	// 登录
	g.GET("/system/user/profile", func(c *gin.Context) {
		user := auth.GetLoginUser(c)
		roleNames := service.SelectRoleNamesByUsername(user.User.UserName)
		postNames := service.SelectPostNamesByUsername(user.User.UserName)
		// 返回结果
		rest.Success(user.User).With("roleGroup", roleNames).With("postGroup", postNames).Send(c)
	})
}
